

/*奖项设置*/
var one;
var two = new Array(3);
var three = new Array(5);
var hr;
var people = 0;  //这是得奖的人数，最后控制在9
/*参与人员*/
var renyuan = new Array(100);

/* 这是咱们的奖项设置函数 */
function jiang(a){
	if(a==1){
		var onem = document.getElementById("one").value;
		if(one==null && onem.length>0){
			one = onem;
			document.getElementById("yi").value =one; 
			alert("设置一等奖为"+one+"成功");
			people++;
			document.getElementById("one").value = null;
		}
		else {
			alert("一等奖人员已满！或者得奖者不能为空");
			document.getElementById("one").value = null;
		}
	}
	if(a==2){
		hr = 0;
		var twom = document.getElementById("two").value;
		for(i=1;i<=3;i++){
			if(two[i]==null && twom.length>0){
				two[i] = twom;
				hr = 1;
				document.getElementById("er"+i).value =two[i]; 
				break;
			}
		}
			if(hr==0) alert("二等奖已设置满！或者得奖者不能为空");
			else alert("设置二等奖为"+two[i]+"成功");
			people++;
			document.getElementById("two").value = null;
	}
	if(a==3){
		hr = 0;
		var threem = document.getElementById("three").value;
		
	for(i=1;i<=5;i++){
		if(three[i]==null && threem.length>0){
			three[i] = threem;
			hr = 1;
			document.getElementById("san"+i).value =three[i]; 
			break;
		}
	}
		if(hr==0) alert("三等奖已设置满！或者得奖者不能为空");
		else alert("设置三等奖为"+three[i]+"成功");
		people++;
		document.getElementById("three").value = null;
	}
	
}

/*这是删除人员函数*/
function shanchu(zu,shu){
	if(zu==1 && document.getElementById("yi").value.length>0){
		one = null;
		document.getElementById("yi").value = null;
		document.getElementById("one").value = null;
		people--;
	}
	else if(zu==2 && document.getElementById("er"+shu).value.length>0){
		two[shu] = null;
		document.getElementById("er"+shu).value = null;
		document.getElementById("two").value = null;
		people--;
	}
	else if(document.getElementById("san"+shu).value.length>0){
		three[shu] = null;
		document.getElementById("san"+shu).value = null;
		document.getElementById("three").value = null;
		people--;
	}
}



/*页面转换函数*/
function opens(x) {
	for(var i=0;i<=5;i++) {
		if(i==x) {
			document.getElementById("mian"+i).style.display = "block";
		}else 
		document.getElementById("mian"+i).style.display = "none";
	}
}

/*这是返回主页面函数*/
function fanhui(y){
	document.getElementById("mian"+y).style.display = "none";
	document.getElementById("mian0").style.display = "block";
}



/*
 这是参与人员函数 
 var renyuan = new Array(100);
*/
var renshu = 0;
function mingdan(){
	var mingzi = document.getElementById("ming").value;
	/*var renyuan=new Array();*/
	/*renyuan.put(mingzi);*/
	if(mingzi.length>0){
	renyuan[renshu] = mingzi;
	renshu++;
	document.getElementById("ming").value = null;
	
	
		document.getElementById("mingdan").innerHTML += 
		`
			<div style="width: 20%; font-size: 25px; color: #FFFFFF; float: left; margin-bottom: 30px; text-align: center;">
				<span>${mingzi}</span>
			</div>
		`
	} else{
		alert("添加人员不能为空！");
	}

	
}


/*开始抽奖函数（将所有的得奖者随机数筛选出来，然后进行屏幕动画演示）*/
function choujiang(){
	var tu = document.getElementById("tupian");
	// tu.style.transform = "scaleY(20deg)";
	// if(one != null){
	// 	console.log(one);
	// }
	// for(var i = 0; i <= 2; i++){
	// 	if(two[i] != null){
			
	// 	}
	// }
	// for(var j = 0; j<=4; j++){
	// 	if(three[i] != null){

	// 	}
	// }
	console.log("一等奖:",one);
	console.log("二等奖:",two);
	console.log("一等奖:",three);

}